home *** CD-ROM | disk | FTP | other *** search
/ Aminet 16 / Aminet 16 (1996)(GTI - Schatztruhe)[!][Dec 1996].iso / Aminet / dev / src / wangisrc.lha / wangi / z / wpad_library / WPP_AddHotKeys.c < prev    next >
C/C++ Source or Header  |  1995-08-29  |  2KB  |  70 lines

  1. /***************************************************************************
  2.  * WPP_AddHotKeys.c
  3.  *
  4.  * wpad.library, Copyright ©1995 Lee Kindness.
  5.  *
  6.  * WPP_AddHotKeys()
  7.  */
  8.  
  9. #include "wpad_global.h"
  10.  
  11. VOID __regargs WPP_AddHotKeys( struct Pad *pad )
  12. {
  13.     pad->pad_CxMsgPort = NULL;
  14.     if( pad->pad_Broker )
  15.     {
  16.         if( pad->pad_CxMsgPort = CreateMsgPort() )
  17.         {
  18.             struct PadItem *node;
  19.             /* Add main hotkey */
  20.             if( pad->pad_HotKey )
  21.             {
  22.                 /* filter */
  23.                 if( pad->pad_HotKeyH = CxFilter(pad->pad_HotKey) )
  24.                 {
  25.                     CxObj *sender;
  26.                     /* sender */
  27.                     AttachCxObj(pad->pad_Broker, pad->pad_HotKeyH);
  28.                     if( sender = CxSender(pad->pad_CxMsgPort, EVENT_MAINHOTKEY) )
  29.                     {
  30.                         CxObj *trans;
  31.                         /* translater */
  32.                         AttachCxObj(pad->pad_HotKeyH, sender);
  33.                         if( trans = CxTranslate(NULL) )
  34.                         {
  35.                             AttachCxObj(pad->pad_HotKeyH, trans);
  36.                         }
  37.                     }
  38.                 }
  39.             }
  40.             
  41.             /* Add hotkeys for the items */
  42.             for(node = (struct PadItem *)pad->pad_Items->lh_Head; 
  43.                 node->pi_Node.ln_Succ;
  44.                 node = (struct PadItem *)node->pi_Node.ln_Succ)
  45.             {
  46.                 if( node->pi_HotKey )
  47.                 {
  48.                     /* filter */
  49.                     if( node->pi_Handles->pih_HotKey = CxFilter(node->pi_HotKey) )
  50.                     {
  51.                         CxObj *sender;
  52.                         /* sender */
  53.                         AttachCxObj(pad->pad_Broker, node->pi_Handles->pih_HotKey);
  54.                         if( sender = CxSender(pad->pad_CxMsgPort, (LONG)node) )
  55.                         {
  56.                             CxObj *trans;
  57.                             AttachCxObj(node->pi_Handles->pih_HotKey, sender);
  58.                             /* translater */
  59.                             if( trans = CxTranslate(NULL) )
  60.                             {
  61.                                 AttachCxObj(node->pi_Handles->pih_HotKey, trans);
  62.                             }
  63.                         }
  64.                     }
  65.                 }
  66.             }
  67.         }
  68.     }
  69. }
  70.